Title Banner

Previous Book Contents Book Index Next

Inside Macintosh: QuickDraw GX Graphics /
Chapter 3 - Geometric Styles / Geometric Styles Reference
Functions / Getting and Setting the Pen Width


GXSetStylePen

You can use the GXSetStylePen function to change the pen width of a style object.

void GXSetStylePen(gxStyle target, Fixed pen);
target
A reference to the style object whose pen width you want to change.
pen
The new pen width.
DESCRIPTION
The GXSetStylePen function sets the pen width of the style object specified by the target parameter to the value specified in the pen parameter. You may specify any nonnegative value for this parameter.

A pen width of 0 indicates a hairline; QuickDraw GX always draws hairlines one pixel wide.

Remember that the pen parameter is specified as a fixed-point value. Very small diameters may cause all drawing to disappear, since a shape may fall between pixels. A common mistake when setting the pen width is to specify the pen width as an integer, rather than a fixed-point value:

GXSetStylePen(myStyle, 1);  /* set the pen width to 1/65536 */
GXSetStylePen(myStyle, ff(1));  /* set the pen width to 1.0 */
When you set the pen width using this function, you are effectively changing the pen width for all shapes that share the style.

ERRORS, WARNINGS, AND NOTICES
Errors 
out_of_memory 
style_is_nil 
parameter_out_of_range(debugging version)
Notices (debugging version) 
pen_size_already_set 
SEE ALSO
For a discussion of the drawing pen, see "The Geometric Pen" on page 3-15.

For an example of changing a shape's pen width, see "Manipulating Pen Width and Placement" on page 3-51.

To determine the pen width of a style object, use the GXGetStylePen function, which is described on page 3-119.

To determine the pen width of a style object associated with a particular shape, use the GXGetShapePen function, which is described in the next section. To change the pen width of a style object associated with a particular shape, use the GXSetShapePen function, which is described on page 3-122.


Previous Book Contents Book Index Next

© Apple Computer, Inc.
7 JUL 1996




Navigation graphic, see text links

Main | Page One | What's New | Apple Computer, Inc. | Find It | Contact Us | Help